// AniMolDoc.cpp : implementation of the CAniMolDoc class
//

#include "stdafx.h"
#include "AniMol.h"

#include "AniMolDoc.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAniMolDoc

IMPLEMENT_DYNCREATE(CAniMolDoc, CDocument)

BEGIN_MESSAGE_MAP(CAniMolDoc, CDocument)
	//{{AFX_MSG_MAP(CAniMolDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAniMolDoc construction/destruction



CAniMolDoc::CAniMolDoc()
{
	// TODO: add one-time construction code here
	ifstream fin;
	fin.open(".\\test.mol");
	//**********Junk Block*********
	char buff[300];
	int no_atom, no_bond;
	fin.getline(buff,300);
	fin.getline(buff,300);
	fin.getline(buff,300);
	fin>>no_atom>>no_bond; //Nothing is a real junk here
	fin.getline(buff,300);
	
	//******** Atom Block**********
	double tx, ty, tz;
	char Atom_name;
	
	int t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12;

	//********Bond Block***********
	int atom1, atom2, Bond_type;
	int tb1,tb2,tb3,tb4;
	
	for(int i = 0; i< no_atom; i++)
	{
		fin>>tx>>ty>>tz;
		fin>>Atom_name;
		fin>>t1>>t2>>t3>>t4>>t5>>t6>>t7>>t8>>t9>>t10>>t11>>t12;
		Atom temp;
		temp.ser_no = i+1;
		temp.atom_name = Atom_name;
		temp.x_coord = tx;
		temp.y_coord = ty;
		AtomList.push_back(temp);
	}
	for(i = 0; i< no_bond; i++)
	{
		fin>>atom1>>atom2>>Bond_type;
		fin>>tb1>>tb2>>tb3>>tb4;
		Bond temp;
		temp.atom1 = atom1;
		temp.atom2 = atom2;
		temp.bond_type = Bond_type;
		BondList.push_back(temp);
	}


}

CAniMolDoc::~CAniMolDoc()
{
}

BOOL CAniMolDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CAniMolDoc serialization

void CAniMolDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CAniMolDoc diagnostics

#ifdef _DEBUG
void CAniMolDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CAniMolDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CAniMolDoc commands
